[20250407] BOJ / G2 / 방문 판매 / 권혁준 #302
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/23748
🧭 풀이 시간
26분
👀 체감 난이도
✏️ 문제 설명
두 제품을 적어도 각각 X, Y이상 팔아야 한다.
N명의 고객 각각에게 판매 성공 시, 해당 고객은 두 제품을 x[i], y[i]만큼 구매한다.
할당량을 넘기기 위해 판매 성공해야하는 최소 고객 수와 이 때 마지막으로 판매에 성공하는 고객 번호를 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
dp[x][c] = 두 제품 중 첫 번째 제품을 x만큼 판매했고 고객 c명에게 판매 성공했을 때, 두 번째 제품 판매량의 최댓값rec[x][c] = dp[x][c]가 Y를 넘은 경우, 마지막으로 판매에 성공한 고객 번호위와 같이 dp를 정의하고 배낭 문제 풀이법을 적용하여 풀었다.
⏳ 회고
답이 될 수 있는 상황을 모두 고려하지 않고 풀어서 틀렸었다